package com.weizhu.swufer.core.entity;

import com.weizhu.swufer.constant.SwuferConstant;

import java.io.Serializable;
import java.util.Arrays;

public class RpcBaseInfo implements Serializable {
    private static final long serialVersionUID = 1L;
    private String group;
    private String service;
    private String type;
    private Object target;
    private String set;
    private String version;
    private String ip;
    private int port;

    private String token;
    private int weight = 100;
    private int qps;
    private String nodeId;

    private Class<?> []clzs;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getGroup() {
        return group;
    }
    public void setGroup(String group) {
        this.group = group;
    }
    public String getService() {
        return service;
    }
    public void setService(String service) {
        this.service = service;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Object getTarget() {
        return target;
    }
    public void setTarget(Object target) {
        this.target = target;
    }

    public String getSet() {
        return set;
    }
    public void setSet(String set) {
        this.set = set;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public String getAddress(){
        return this.ip + SwuferConstant.IP_ADDRESS_DELIMITER + this.port;
    }

    public int getQps() {
        return qps;
    }

    public void setQps(int qps) {
        this.qps = qps;
    }

    @Override
    public String toString() {
        return "RpcBaseInfo{" +
                "group='" + group + '\'' +
                ", service='" + service + '\'' +
                ", type='" + type + '\'' +
                ", target=" + target +
                ", set='" + set + '\'' +
                ", version='" + version + '\'' +
                ", ip='" + ip + '\'' +
                ", port=" + port +
                ", nodeId='" + nodeId + '\'' +
                ", clzs=" + Arrays.toString(clzs) +
                '}';
    }
}
